<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <div id="app">
        <!-- VUE不支持驼峰原则,所以如果子组件中为驼峰,那么在使用时驼峰使用 - 进行分割-->
        <cpn :c-info="info" :child-my-message="message"></cpn>
    </div>

    <template id="cpn">
        <!-- 子组件必须包含一个根元素 -->
        <div>
            <h2>{{cInfo}}</h2>
            <h2>{{childMyMessage}}</h2>
        </div>
    </template>

    <script src="../js/vue.js"></script>
    <script>
        const cpn = {
            template: '#cpn',
            props: {
                cInfo: {
                    type: Object,
                    default(){
                        return {}
                    }
                },
                childMyMessage: {
                    type: String,
                    default: ''
                }
            }
        }

        const app = new Vue({
            el: '#app',
            data: {
                info: {
                    name: '苏州大学',
                    age: 120,
                    height: 1.88
                },
                message: '养天地正气,法古今完人'
            },
            components: {
                cpn
            }
        })
    </script>
</body>
</html>